/**
 * 以函数的方式自定义模拟数据模板
 *
 * @module mock/templates
 *
 * @example 模板定义方法
 *
 * export function templateFuncName(Mock, url, query) {
 *    return {code:0, data:[], msg: ''}
 * }
 *
 */

export const usersLogin = function (Mock, url, query) {
  return {code: 0, data: {token: '111adfsdkflksjdkfljklsdjfkl'}, msg: ''}
}

export const mockDictList = function (Mock, url, query) {
  const dictList = [
    {
      pkValue: '1dict1',
      dictValue: 'dict1',
      dictLabel: '字典1'
    },
    {
      pkValue: '1dict2',
      dictValue: 'dict2',
      dictLabel: '字典2'
    }
  ]

  return {code: 0, data: dictList, message: ''}
}

export const mockMenusList = function (Mock, url, query) {
  const menuData = {
    set: [
      {
        menuId: '0AF21ABED16645ED98E5FCF111CB3819',
        parentId: '',
        name: '设置',
        pkValue: '0AF21ABED16645ED98E5FCF111CB3819',
        path: '',
        icon: '',
        orderNum: 0,
        type: 0,
        children: [
          {
            menuId: 'C4751862364B4BD992F6B2EF4DDCABFD',
            parentId: '0AF21ABED16645ED98E5FCF111CB3819',
            name: '角色管理',
            pkValue: 'C4751862364B4BD992F6B2EF4DDCABFD',
            path: '/clue/role',
            icon: '',
            orderNum: 1,
            type: 0,
            children: null
          },
          {
            menuId: '274FE9318F9740769FF03DB58EAFCE12',
            parentId: '0AF21ABED16645ED98E5FCF111CB3819',
            name: '系统日志',
            pkValue: '274FE9318F9740769FF03DB58EAFCE12',
            path: '/clue/log',
            icon: '',
            orderNum: 2,
            type: 0,
            children: null
          },
          {
            menuId: 'A6B717F3B8224686A0F01C4EE967A407',
            parentId: '0AF21ABED16645ED98E5FCF111CB3819',
            name: '单位管理',
            pkValue: 'A6B717F3B8224686A0F01C4EE967A407',
            path: '/clue/org',
            icon: '',
            orderNum: 3,
            type: 0,
            children: null
          },
          {
            menuId: 'A1E43DB419DB41CBAFFD16B4178782C1',
            parentId: '0AF21ABED16645ED98E5FCF111CB3819',
            name: '用户管理',
            pkValue: 'A1E43DB419DB41CBAFFD16B4178782C1',
            path: '/clue/user',
            icon: '',
            orderNum: 4,
            type: 0,
            children: null
          },
          {
            menuId: '60CA7405E262439C86F526921192FB6D',
            parentId: '0AF21ABED16645ED98E5FCF111CB3819',
            name: '自定义表单',
            pkValue: '60CA7405E262439C86F526921192FB6D',
            path: '/clue/formlist',
            icon: '',
            orderNum: 5,
            type: 0,
            children: null
          }
        ]
      }
    ],
    menus: [
      {
        menuId: 'C5C8238A798A4F63AFA9956AEB82109C',
        parentId: '',
        name: '线索管理',
        pkValue: 'C5C8238A798A4F63AFA9956AEB82109C',
        path: '/clue/management',
        icon: 'iconfont icon-home',
        orderNum: 1,
        type: 0,
        children: [
          {
            menuId: '20180718192948178966',
            parentId: 'C5C8238A798A4F63AFA9956AEB82109C',
            name: '省单位审批',
            pkValue: '20180718192948178966',
            path: 'management?type=usertask3',
            icon: '',
            orderNum: 3,
            type: 0,
            children: null
          }
        ]
      },
      {
        menuId: '76AF0C3B07E341B3A68207AF4F9EA43D',
        parentId: '',
        name: '线索侦办',
        pkValue: '76AF0C3B07E341B3A68207AF4F9EA43D',
        path: '/clue/Investigation',
        icon: 'iconfont icon-home',
        orderNum: 2,
        type: 0,
        children: null
      }
    ]
  }
  return {code: 0, data: menuData, message: ''}
}

export const JsControlqx = function (Mock, url, query) {
  const data = [
    {
      parentId: '',
      name: '设置',
      pkValue: '0AF21ABED16645ED98E5FCF111CB3819',
      children: [
        {
          parentId: '0AF21ABED16645ED98E5FCF111CB3819',
          name: '角色管理',
          pkValue: 'C4751862364B4BD992F6B2EF4DDCABFD',
          children: null
        },
        {
          parentId: '0AF21ABED16645ED98E5FCF111CB3819',
          name: '系统日志',
          pkValue: '274FE9318F9740769FF03DB58EAFCE12',
          children: null
        },
        {
          parentId: '0AF21ABED16645ED98E5FCF111CB3819',
          name: '单位管理',
          pkValue: 'A6B717F3B8224686A0F01C4EE967A407',
          children: null
        },
        {
          parentId: '0AF21ABED16645ED98E5FCF111CB3819',
          name: '用户管理',
          pkValue: 'A1E43DB419DB41CBAFFD16B4178782C1',
          children: null
        },
        {
          parentId: '0AF21ABED16645ED98E5FCF111CB3819',
          name: '自定义表单',
          pkValue: '60CA7405E262439C86F526921192FB6D',
          children: null
        }
      ]
    },
    {
      parentId: '',
      name: '线索管理',
      pkValue: 'C5C8238A798A4F63AFA9956AEB82109C',
      children: [
        {
          parentId: 'C5C8238A798A4F63AFA9956AEB82109C',
          name: '请假',
          pkValue: '20180718192518159432',
          children: null
        },
        {
          parentId: 'C5C8238A798A4F63AFA9956AEB82109C',
          name: '线索上报',
          pkValue: '20180718192948135702',
          children: null
        },
        {
          parentId: 'C5C8238A798A4F63AFA9956AEB82109C',
          name: '市单位审批',
          pkValue: '20180718192948106144',
          children: null
        },
        {
          parentId: 'C5C8238A798A4F63AFA9956AEB82109C',
          name: '审批',
          pkValue: '20180718192518188287',
          children: null
        },
        {
          parentId: 'C5C8238A798A4F63AFA9956AEB82109C',
          name: '省单位审批',
          pkValue: '20180718192948178966',
          children: null
        },
        {
          parentId: 'C5C8238A798A4F63AFA9956AEB82109C',
          name: '反馈',
          pkValue: '20180718192948136999',
          children: null
        }
      ]
    },
    {
      parentId: '',
      name: '线索侦办',
      pkValue: '76AF0C3B07E341B3A68207AF4F9EA43D',
      children: null
    }
  ]
  return {code: 0, data: data, message: ''}
}

export const mockCustomForm = function (Mock, url, query) {
  const customForm = [
    // {
    //   type: 'title',
    //   valuezd: 'f0',
    //   props: {
    //     title: '基本信息'
    //   }
    // },
    // {
    //   name: 'account',
    //   type: 'input',
    //   label: '账号名称',
    //   columnNumber: 1,
    //   valuezd: 'f1',
    //   rules: {
    //     required: true
    //   }
    // },
    // {
    //   name: 'desc',
    //   type: 'input',
    //   label: '描述',
    //   columnNumber: 1,
    //   valuezd: 'f2',
    //   props: {
    //     type: 'textarea',
    //     rows: 5
    //   }
    // },
    // {
    //   name: 'sfla',
    //   type: 'radio',
    //   label: '是否立案',
    //   columnNumber: 3,
    //   valuezd: 'f3',
    //   useMethod: 'methodValue',
    //   dictionary: 'sfla',
    //   optionUrl: '/api/getDictList',
    //   methodValue: [{dictValue: '0', dictLabel: '是'}, {dictValue: '1', dictLabel: '否'}]
    // },
    // {
    //   name: 'ajlx',
    //   type: 'checkbox',
    //   label: '案件类型',
    //   columnNumber: 3,
    //   valuezd: 'f4',
    //   useMethod: 'dictionary',
    //   dictionary: 'ajlb',
    //   optionUrl: '/api/getDictList',
    //   methodValue: null
    // },
    // {
    //   name: 'category',
    //   type: 'select',
    //   label: '类型',
    //   columnNumber: 3,
    //   valuezd: 'f5',
    //   useMethod: 'dictionary',
    //   dictionary: 'ajlb',
    //   optionUrl: '/api/getDictList',
    //   methodValue: null
    // },
    // {
    //   name: 'province',
    //   type: 'select',
    //   label: '选择省',
    //   columnNumber: 3,
    //   valuezd: 'f6',
    //   inline: true,
    //   methodValue: [
    //     {label: '广东省', name: 'cate1'},
    //     {label: '广西省', name: 'cate2'}
    //   ],
    //   branches: {
    //     'cate1': [
    //       {
    //         name: 'cate11',
    //         type: 'select',
    //         label: '选择市',
    //         columnNumber: 3,
    //         inline: true,
    //         valuezd: 'f7',
    //         methodValue: [
    //           {label: '广州市', name: 'cate1-1'},
    //           {label: '佛山市', name: 'cate1-2'}
    //         ]
    //       }
    //     ],
    //     'cate2': [
    //       {
    //         name: 'cate22',
    //         type: 'select',
    //         columnNumber: 3,
    //         inline: true,
    //         label: '选择市',
    //         valuezd: 'f8',
    //         methodValue: [
    //           {label: '桂林市', name: 'cate2-1'},
    //           {label: '阳朔市', name: 'cate2-2'}
    //         ]
    //       }
    //     ]
    //   }
    // },
    // {
    //   name: 'switchCategory',
    //   type: 'select',
    //   label: '切换类型',
    //   columnNumber: 3,
    //   valuezd: 'f9',
    //   methodValue: [
    //     {dictLabel: '选项一', dictValue: 'cate01'},
    //     {dictLabel: '选项二', dictValue: 'cate02'}
    //   ],
    //   branches: {
    //     'cate01': [
    //       {
    //         label: '名称一',
    //         type: 'input',
    //         valuezd: 'f10',
    //         name: 'option1'
    //       }
    //     ],
    //     'cate02': [
    //       {
    //         label: '名称二',
    //         columnNumber: 3,
    //         type: 'input',
    //         valuezd: 'f11',
    //         name: 'option2'
    //       }
    //     ]
    //   }
    // },
    // {
    //   name: 'testSwitchCategory1',
    //   type: 'select',
    //   label: '测试级联1',
    //   columnNumber: 3,
    //   valuezd: 'f12',
    //   methodValue: [
    //     {dictLabel: 'test1', dictValue: 'cate11'},
    //     {dictLabel: 'test2', dictValue: 'cate22'}
    //   ],
    //   grade: {
    //     name: 'testSwitchCategory2',
    //     type: 'select',
    //     label: '测试级联2',
    //     valuezd: 'f13',
    //     columnNumber: 3,
    //     methodValue: [
    //       {dictLabel: 'test1', dictValue: 'cate21'},
    //       {dictLabel: 'test2', dictValue: 'cate22'}
    //     ],
    //     grade: {
    //       name: 'testSwitchCategory3',
    //       type: 'select',
    //       label: '测试级联3',
    //       valuezd: 'f14',
    //       columnNumber: 3,
    //       methodValue: [
    //         {dictLabel: 'test1', dictValue: 'cate31'},
    //         {dictLabel: 'test2', dictValue: 'cate32'}
    //       ]
    //     }
    //   }
    // },
    // {
    //   name: 'afsj',
    //   type: 'datePicker',
    //   label: '案发时间',
    //   valuezd: 'f15',
    //   props: {
    //     type: 'daterange',
    //     rangeSeparator: '至',
    //     startPlaceholder: '开始日期',
    //     endPlaceholder: '结束日期'
    //   }
    // },
    // {
    //   name: 'treeselect',
    //   type: 'treeselect',
    //   label: '组织选择',
    //   props: {
    //     nodeKey: 'label'
    //   },
    //   valuezd: 'f16',
    //   options: [{
    //     label: '一级 1',
    //     children: [{
    //       label: '二级 1-1',
    //       children: [{
    //         label: '三级 1-1-1'
    //       }]
    //     }]
    //   }, {
    //     label: '一级 2',
    //     children: [{
    //       label: '二级 2-1',
    //       children: [{
    //         label: '三级 2-1-1'
    //       }]
    //     }, {
    //       label: '二级 2-2',
    //       children: [{
    //         label: '三级 2-2-1'
    //       }]
    //     }]
    //   }]
    // },
    // {
    //   // 上传下载地址已经在config.js配置好
    //   name: 'uploader',
    //   type: 'upload',
    //   valuezd: 'f17',
    //   label: '上传文书' // ,
    //   // rules: {required: true}
    // },
    // {
    //   name: 'attachments',
    //   type: 'attachments',
    //   label: '附件下载',
    //   valuezd: 'f18',
    //   columnNumber: 1,
    //   optionUrl: '/api/getAttachmentsList'
    // },
    // {
    //   name: 'wsAttachments',
    //   type: 'attachments',
    //   label: '文书下载',
    //   valuezd: 'f19',
    //   columnNumber: 1,
    //   optionUrl: '/api/getAttachmentsList'
    // },
    {
      name: 'import',
      type: 'import',
      label: '批量导入',
      valuezd: 'f20',
      columnNumber: 1
    },
    {
      name: 'accounts',
      type: 'dynamic',
      inline: true,
      valuezd: 'f21',
      children: [
        [
          {
            name: 'xm',
            label: '姓名',
            type: 'input',
            rules: {
              required: true
            }
          },
          {
            name: 'email',
            label: '邮箱',
            type: 'input'
          },
          {
            name: 'phone',
            label: '手机',
            type: 'input',
            rules: {
              required: true
            }
          },
          {
            name: 'sex',
            type: 'select',
            label: '性别',
            useMethod: 'dictionary',
            dictionary: 'ajlb',
            optionUrl: '/api/getDictList',
            methodValue: null,
            rules: {
              required: true
            }
          }
        ]
      ]
    }
  ]
  return {code: 0, data: customForm, message: ''}
}

export const mockItemList = function (Mock, url, query) {
  return {
    code: 0,
    data: {
      limit: '10',
      list: [{
        isBranches: [],
        type: 'input',
        items: [{
          label: '警号',
          name: 'jh',
          type: '',
          useMethod: '',
          dictionaryName: '',
          optionUrl: '',
          methodValue: '',
          timeType: '',
          isRequired: ['required'],
          rulesMethod: '',
          rulesRegExp: ''
        }]
      }, {
        type: 'textarea',
        isBranches: [],
        items: [{
          label: 'wenben',
          name: 'jh',
          type: null,
          useMethod: '',
          dictionaryName: null,
          optionUrl: null,
          methodValue: null,
          timeType: '',
          isRequired: ['required'],
          rulesMethod: '',
          rulesRegExp: '343'
        }]
      }, {
        isBranches: ['true'],
        type: 'select',
        items: [{
          label: 'select',
          name: 'select',
          type: 'select',
          useMethod: 'methodValue',
          dictionaryName: null,
          optionUrl: null,
          methodValue: [
            {dictLabel: 'test1', dictValue: 'cate1'},
            {dictLabel: 'test2', dictValue: 'cate2'}
          ],
          timeType: '',
          isRequired: ['required'],
          rulesMethod: '',
          rulesRegExp: ''
        }, {
          label: 'select2',
          name: 'select2',
          type: 'select',
          useMethod: 'methodValue',
          dictionaryName: null,
          optionUrl: null,
          methodValue: [
            {dictLabel: 'test1', dictValue: 'cate1'},
            {dictLabel: 'test2', dictValue: 'cate2'}
          ],
          timeType: '',
          isRequired: ['required'],
          rulesMethod: '',
          rulesRegExp: ''
        }, {
          label: 'select3',
          name: 'select3',
          type: 'select',
          useMethod: 'methodValue',
          dictionaryName: null,
          optionUrl: null,
          methodValue: [
            {dictLabel: 'test1', dictValue: 'cate1'},
            {dictLabel: 'test2', dictValue: 'cate2'}
          ],
          timeType: '',
          isRequired: ['required'],
          rulesMethod: '',
          rulesRegExp: ''
        }]
      }, {
        isBranches: [],
        type: 'dynamic',
        items: [{
          label: 'select',
          name: 'select',
          type: 'select',
          useMethod: 'methodValue',
          dictionaryName: null,
          optionUrl: null,
          methodValue: [
            {dictLabel: 'test1', dictValue: 'cate1'},
            {dictLabel: 'test2', dictValue: 'cate2'}
          ],
          timeType: '',
          isRequired: ['required'],
          rulesMethod: '',
          rulesRegExp: ''
        }, {
          label: 'select2',
          name: 'select2',
          type: 'select',
          useMethod: 'methodValue',
          dictionaryName: null,
          optionUrl: null,
          methodValue: [
            {dictLabel: 'test1', dictValue: 'cate1'},
            {dictLabel: 'test2', dictValue: 'cate2'}
          ],
          timeType: '',
          isRequired: ['required'],
          rulesMethod: '',
          rulesRegExp: ''
        }, {
          label: 'select3',
          name: 'select3',
          type: 'select',
          useMethod: 'methodValue',
          dictionaryName: null,
          optionUrl: null,
          methodValue: [
            {dictLabel: 'test1', dictValue: 'cate1'},
            {dictLabel: 'test2', dictValue: 'cate2'}
          ],
          timeType: '',
          isRequired: ['required'],
          rulesMethod: '',
          rulesRegExp: ''
        }]
      }],
      page: '1',
      total: 1
    },
    message: '获取列表成功'
  }
}

export const orgTree = function (Mock, url, query) {
  return {
    code: 0,
    data: [
      {
        id: '340000',
        pid: '',
        label: 'XX省公安厅',
        children: [
          {
            id: '340800',
            pid: '340000',
            label: 'XX省xx市公安局',
            children: [
              {
                id: '348888',
                pid: '340800',
                label: 'XX省xx市xx县公安局',
                children: null
              }
            ]
          }
        ]
      }
    ]
  }
}

export const mockClueCols = function (Mock, url, query) {
  const cols = [
    {'ssDict': null, 'valuezd': 'processinstanceid', 'sfss': 1, 'zdmc': '线索编号', 'sfpx': 0},
    {'ssDict': null, 'valuezd': 'startuserid', 'sfss': 1, 'zdmc': '上报人', 'sfpx': 1},
    {'ssDict': null, 'valuezd': 'ajbh', 'sfss': 1, 'zdmc': '案件编号', 'sfpx': 1},
    {'ssDict': null, 'valuezd': 'createdtime', 'sfss': 1, 'zdmc': '线索登记时间', 'sfpx': 0},
    {'ssDict': null, 'valuezd': 'auditor', 'sfss': 1, 'zdmc': '最后操作', 'sfpx': 1},
    {'ssDict': 'dwmc', 'valuezd': 'dwmc', 'sfss': 0, 'zdmc': '创建单位', 'sfpx': 1},
    {'ssDict': null, 'valuezd': 'taskname', 'sfss': 1, 'zdmc': '线索状态', 'sfpx': 1}
  ]
  return {code: 0, msg: 'success', data: cols}
}

export const mockClueFlow = function (Mock, url, query) {
  const data = [
    {'result': '1', 'audittime': '', 'name': 'usertask1', 'bz': '', 'auditor': '', 'icon': 'icon-paper-list', 'label': '线索上报'},
    {'result': '', 'audittime': '', 'name': 'usertask2', 'bz': '', 'auditor': '', 'icon': 'icon-paper-list', 'label': '市单位审批'},
    {'result': '', 'audittime': '', 'name': 'usertask3', 'bz': '', 'auditor': '', 'icon': 'icon-hammer', 'label': '省单位审批'},
    {'result': '', 'audittime': '', 'name': 'usertask4', 'bz': '', 'auditor': '', 'icon': 'icon-editor', 'label': '反馈'}
  ]
  return {code: 0, msg: 'success', data: data}
}

export const mockDeleteClue = function (Mock, url, query) {
  return {code: 0, msg: 'success', data: null}
}
